{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">添加外部链接</div>
    <div class="layui-card-body">
        <form class="layui-form" method="post">
            <div class="layui-tab">
                <ul class="layui-tab-title">
                    <li class="layui-this">基本设置</li>
                    <li>选项设置</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <div class="layui-form-item">
                            <label>上级菜单</label>
                            <div class="w300">
                                <select name="parentid" lay-verify="required">
                                    <option value="0">作为顶级栏目</option>
                                    {$category|raw}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label>栏目标题 </label>
                            <div class="w300">
                                <input type="text" name="catname" lay-verify="required" autocomplete="off" placeholder="栏目名称" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label>唯一标识</label>
                            <div class="w300">
                                <input type="text" name="catdir" autocomplete="off" placeholder="唯一标识" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">留空自动生成拼音，英文数字组成</div>
                        </div>
                        <div class="layui-form-item web_link">
                            <label>链接地址</label>
                            <div>
                                <div class="layui-input-inline w300">
                                    <input type="text" name="url" lay-verify="required" autocomplete="off" placeholder="自定义链接地址" class="layui-input" id="url">
                                </div>
                                <div class="layui-input-inline">
                                    <select lay-filter="fasttype">
                                        <option data-url="">常用内部链接</option>
                                        <option data-url="cms/index/index">首页</option>
                                        <option data-url="cms/index/lists?catid=2">列表页/单页</option>
                                        <option data-url="cms/index/shows?catid=2&id=1">详情页</option>
                                        {if isModuleInstall('formguide')}
                                        <option data-url="formguide/index/index?id=2">表单页</option>
                                        {/if}
                                    </select>
                                </div>
                            </div>
                            <div style="clear: both;"></div>
                            <div class="layui-form-mid layui-word-aux">内部链接格式:模块/控制器/操作?参数=参数值&...，外部链接则必须http://开头</div>
                        </div>
                        <div class="layui-form-item web_seo">
                            <label>栏目简介</label>
                            <div class="w300">
                                <textarea name="description" placeholder="栏目简介" class="layui-textarea"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label>栏目图片</label>
                            <div class="layui-form-field-label">
                                <div class="js-upload-image">
                                    {php}echo \util\Form::images('image'){/php}
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-form-item">
                            <label>在导航显示</label>
                            <div class="w300">
                                <input type="radio" name="status" value="1" title="显示" checked>
                                <input type="radio" name="status" value="0" title="隐藏">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label>显示排序</label>
                            <div class="w300">
                                <input type="text" name="listorder" autocomplete="off" placeholder="显示排序" class="layui-input" value="100">
                            </div>
                        </div>
                    </div>
                </div>
                <input type="hidden" name="type" value="3">
                <div class="layui-form-item">
                    <div>
                        <button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
                        <button class="layui-btn layui-btn-normal" type="button" onclick="javascript:history.back(-1);">返回</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__STATIC__/libs/viewer/viewer.min.js"></script>
<link rel="stylesheet" href="__STATIC__/libs/viewer/viewer.min.css">
<script type="text/javascript">
layui.use('form', function() {
    var form = layui.form;
    form.on('select(fasttype)', function(data) {
        $('#url').val($(data.elem).find("option:selected").attr("data-url"));
    });
});

$('.uploader-list').each(function() {
    $(this).viewer();
});
</script>
{/block}